import {userInfo,Profile} from '../types/data'
import {profileAction} from '../types/store'
// 用户信息 用户个人资料的类型
type T ={
    user: userInfo,
    profile: Profile
}
// 初始值的类型
const initState:T={
    user:{},
    profile: {}
}  as T
// 用户登录的action
const profile=(state:T=initState,action:profileAction)=>{
    if(action.type==="profile/getUserInfo") {
        return {...state,user:action.payload}
    } else if(action.type==="profile/getProfile") {
        return {...state,profile:action.payload}
    }
    return state
}
export default profile